<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Sets sorting criteria</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.yaz-set-option.html">yaz_set_option</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.yaz-syntax.html">yaz_syntax</a></div>
 <div class="up"><a href="ref.yaz.html">YAZ 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.yaz-sort" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">yaz_sort</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.7, PECL yaz &gt;= 0.9.0)</p><p class="refpurpose"><span class="refname">yaz_sort</span> &mdash; <span class="dc-title">Sets sorting criteria</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.yaz-sort-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>yaz_sort</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$id</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$criteria</code></span>
   )</div>

  <p class="para rdfs-comment">
   This function sets sorting criteria and enables Z39.50 Sort.
  </p>
  <p class="para">
   Call this function <em class="emphasis">before</em> <span class="function"><a href="function.yaz-search.html" class="function">yaz_search()</a></span>.
   Using this function alone does not have any effect. When used in conjunction
   with <span class="function"><a href="function.yaz-search.html" class="function">yaz_search()</a></span>, a Z39.50 Sort will be sent after a
   search response has been received and before any records are retrieved with
   Z39.50 Present (<span class="function"><a href="function.yaz-present.html" class="function">yaz_present()</a></span>. 
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.yaz-sort-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">id</code></em></dt>

     <dd>

      <p class="para">
       The connection resource returned by <span class="function"><a href="function.yaz-connect.html" class="function">yaz_connect()</a></span>.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">criteria</code></em></dt>

     <dd>

      <p class="para">
       A string that takes the form <span class="replaceable">field1 flags1 field2 
       flags2</span> where field1 specifies the primary attributes for
       sort, field2 seconds, etc.. 
      </p>
      <p class="para">
       The field specifies either a numerical attribute combinations consisting
       of type=value pairs separated by comma (e.g. <em>1=4,2=1</em>)
       ; or the field may specify a plain string criteria (e.g. 
       <em>title</em>. The flags is a sequence of the following 
       characters which may not be separated by any white space.
      </p>
      <p class="para">
       <dl>

        <strong class="title">Sort Flags</strong>
        
         <dt>
<em>a</em></dt>

         <dd>

          <p class="para">
           Sort ascending
          </p>
         </dd>

        
        
         <dt>
<em>d</em></dt>

         <dd>

          <p class="para">
           Sort descending
          </p>
         </dd>

        
        
         <dt>
<em>i</em></dt>

         <dd>

          <p class="para">
           Case insensitive sorting
          </p>
         </dd>

        
        
         <dt>
<em>s</em></dt>

         <dd>

          <p class="para">
           Case sensitive sorting
          </p>
         </dd>

        
       </dl>

      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.yaz-sort-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   没有返回值。
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-function.yaz-sort-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="example-4588">
   <p><strong>Example #1 Sort Criterias</strong></p>
   <div class="example-contents"><p>
    To sort on Bib1 attribute title, case insensitive, and ascending you
    would use the following sort criteria:
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">1=4 ia</pre>
</div>
    </div>
   </p></div>
   <div class="example-contents"><p>
    If the secondary sorting criteria should be author, case sensitive and 
    ascending you would use:
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">1=4 ia 1=1003 sa</pre>
</div>
    </div>
   </p></div>
  </div>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.yaz-set-option.html">yaz_set_option</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.yaz-syntax.html">yaz_syntax</a></div>
 <div class="up"><a href="ref.yaz.html">YAZ 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
